This post was last edited by Iamsai on 2013-09-28 14:04:34
0) reverse_i (substr ($STR, 1)), Echo substr ($STR, 0,1),//return}/* Everyone, look at my idea, right? Reverse (' hello '); function reverse_i (' Hello ') if (strlen (' Hello ')) >0
Php recursion New question this post was last edited by iamsai in 2013-09-2814: 04: 34 & lt ;? Php & nbsp; reverse_ I (hello); & nbsp; function & nbsp; reverse_ I ($ str) {& nbsp; & nbsp; & new php recursion problems
This post was last edited by
Php recursion New question this post was last edited by iamsai in 2013-09-2814: 04: 34 & lt ;? Php & nbsp; reverse_ I ('Hello'); & nbsp; new php recursion problems
This post was last edited by iamsai at 14:04:34
Reverse_ I ('Hello ');Function
Get IP Address
Copy Code code as follows:
function GetIP () {
if ($_server["http_x_forwarded_for"])
$ip = $_server["Http_x_forwarded_for"];
else if ($_server["HTTP_CLIENT_IP"])
$ip = $_server["Http_client_ip"];
else if
function | data | database
Discuz 5.0 do not use their own IP data, but the use of pure IP data format, access to the pure IP database a little trouble, its storage format is more special and interesting, the specific format of the analysis of the
Introduction: this is the core technology of the PHP Forum-detailed page for hierarchical storage, display, and return. It introduces PHP, related knowledge, skills, experience, and some PHP source code.
Class = 'pingjiaf' frameborder = '0' src = '
Php display area code by IP address php display area code by IP
Script ec (2); script
Define ('ipdata _ MINI ', PHPCMS_ROOT. 'include/IPDATA/mini. Dat ');Define ('ipdata _ full', PHPCMS_ROOT. 'include/IPDATA/QQWry. Dat ');
Class ip_area{Var $ fp
It is quite easy to get the IP address first. The following describes two codes for getting the IP address first. You need to use the QQIP library to find the IP address that belongs to the current IP address segment and then obtain the City field
Get IP Address
Copy codeThe Code is as follows: Function GetIP (){
If ($ _ SERVER ["HTTP_X_FORWARDED_FOR"])
$ Ip = $ _ SERVER ["HTTP_X_FORWARDED_FOR"];
Else if ($ _ SERVER ["HTTP_CLIENT_IP"])
$ Ip = $ _ SERVER ["HTTP_CLIENT_IP"];
Else if ($ _ SERVER
Php determines the source code of the IP address. The following code judges the user's city based on the IP address, php judges that the IP address location source code is completely open. the following code calls us to determine the user based on
In many cases, the string truncation function is required. it is not enough because of the encoding problem between gb2312 and UTF-8, the following are the specific implementation methods and the code extracted from some mature systems.
1. Chinese
PHP obtains the specific implementation of the city based on the IP address. File Directory: ipLocation ----- qqwry ---------- QQWry. Dat ----- ipCity. class. phpipCity. class. php file code: Copy the code as follows :? PhpclassipCity {*** obtain
Discuz 5.0 is not using their own IP data, but the use of pure IP data format, access to the pure IP database a little bit of trouble, its storage format is very special and interesting, specific format analysis refer to the following two links,
File directory:
IpLocation----- Qqwry---------- QQWry. Dat----- IpCity. class. php
IpCity. class. php file code:Copy codeThe Code is as follows:
Class ipCity {
/*** Obtain the corresponding City Based on the IP address* @ Param type $ userip user IP
Want to convert IPV4 address to real address, must refer to IP database, commercial IP database stored in relational database, query and use is very convenient, but the cost is not individual and small companies willing to bear, So the idea of
Get IP Address
The code is as follows
Copy Code
function GetIP () {if ($_server["http_x_forwarded_for"])$ip = $_server["Http_x_forwarded_for"];else if ($_server["HTTP_CLIENT_IP"])$ip = $_server["Http_client_ip"];else if (
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.